package com.element.music.service.converter;

import cn.hutool.core.bean.BeanUtil;
import com.element.music.repository.entity.collection.CollectionEntity;
import com.element.music.service.dto.CollectionDTO;

/**
 * 功能描述：
 * <p>
 * User: nft musician developer
 * Date: 2022/1/12
 */

public class CollectionConverter {

    public static CollectionDTO entity2Dto(CollectionEntity collectionEntity) {
        if(collectionEntity == null) {
            return new CollectionDTO();
        }
        CollectionDTO collectionDTO = BeanUtil.copyProperties(collectionEntity, CollectionDTO.class);
        collectionDTO.setCollectionId(collectionEntity.getId());
        return collectionDTO;
    }

    public static CollectionEntity dto2Entity(CollectionDTO collectionDTO) {
        return BeanUtil.copyProperties(collectionDTO, CollectionEntity.class);
    }

}
